//
//  NewStoreImageCoverView.m
//  Yanwei
//
//  Created by weijunjie on 2018/7/26.
//  Copyright © 2018年 DCloud. All rights reserved.
//

#import "NewStoreImageCoverView.h"
@interface NewStoreImageCoverView()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *goOnButton;
@property (nonatomic, strong) UIButton *cancleButton;
@end

@implementation NewStoreImageCoverView

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.titleLabel.text = @"播放将消耗手机流量";
        [self.cancleButton setTitle:@"取消" forState:UIControlStateNormal];
        [self.goOnButton setTitle:@"继续播放" forState:UIControlStateNormal];
    }
    return self;
}

#pragma mark - event
- (void)goOnButtonAction {
    if (self.goOnActionBlock) {
        self.goOnActionBlock();
    }
}

- (void)cancleButtonAction {
    if (self.cancleActionBlock) {
        self.cancleActionBlock();
    }
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.text = @"播放将消耗手机流量";
        _titleLabel.font = APPFONT(14);
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_titleLabel];
        [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.left.right.equalTo(self);
        }];
    }
    return _titleLabel;
}

- (UIButton *)goOnButton {
    if (!_goOnButton) {
        _goOnButton = [[UIButton alloc] init];
        _goOnButton.layer.borderWidth = 0.5;
        _goOnButton.layer.borderColor = [UIColor whiteColor].CGColor;
        _goOnButton.layer.cornerRadius = 17.5;
        _goOnButton.layer.masksToBounds = YES;
        [_goOnButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self addSubview:_goOnButton];
        [_goOnButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.equalTo(self);
            make.width.mas_equalTo(125);
            make.height.mas_equalTo(33);
        }];
        [_goOnButton addTarget:self action:@selector(goOnButtonAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _goOnButton;
}

- (UIButton *)cancleButton {
    if (!_cancleButton) {
        _cancleButton = [[UIButton alloc] init];
        [_cancleButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _cancleButton.layer.borderWidth = 0.5;
        _cancleButton.layer.borderColor = [UIColor whiteColor].CGColor;
        _cancleButton.layer.cornerRadius = 17.5;
        _cancleButton.layer.masksToBounds = YES;
        [self addSubview:_cancleButton];
        [_cancleButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.bottom.equalTo(self);
            make.width.mas_equalTo(125);
            make.height.mas_equalTo(33);
        }];
        [_cancleButton addTarget:self action:@selector(cancleButtonAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _cancleButton;
}

@end
